local skel= fk.CreateSkill{
    name = "history__shenduan",
    tags = {Skill.Compulsory},
}


Fk:loadTranslationTable{
    ["history__shenduan"] = "神锻",
    [":history__shenduan"] = [[锁定技，每回合每个副类别限一次，
    你使用一张装备牌后，根据其副类别执行对应效果：<br>
    武器：你视为使用一张【杀】；<br>
    防具：+1点体力上限并回复一点体力；<br>
    进攻马：弃置每名其他角色各一张牌；<br>
    防御马：摸一张牌且本局手牌上限+1]],

    ["#history__shenduan-discard"] = "神锻：你可以弃置其他角色各一张牌",


}

skel:addEffect(fk.CardUseFinished, {
  anim_type = "drawcard",
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player and data.card.type == Card.TypeEquip
    and not table.contains(player:getTableMark("history__shenduan-turn"), data.card.sub_type)
  end,
  on_use = function (self, event, target, player, data) 
    local room = player.room
    local card = data.card
    local sub_type = card.sub_type
    local mark = player:getTableMark("history__shenduan-turn")
    table.insertIfNeed(mark, sub_type)
    room:setPlayerMark(player,"history__shenduan-turn", mark)

    if sub_type == Card.SubtypeWeapon then
      room:askToUseVirtualCard(player, {  name="slash", prompt="神锻：你可以视为使用一张杀",
        skill_name= skel.name})
    elseif sub_type == Card.SubtypeArmor then
      room:changeMaxHp(player, 1)
      room:recover{
        who = player, 
        num = 1, 
        recoverBy = player,
        skillName = skel.name}
    elseif sub_type == Card.SubtypeOffensiveRide then
      for _, p in ipairs(room:getOtherPlayers(player)) do
          local cards = room:askToCards(player, {
            min_num = 1,
            max_num = 1,
            include_equip = true,
            skill_name = skel.name,
            prompt = "#history__shenduan-discard",
          })
          if #cards > 0 then
            room:throwCard(cards, skel.name, p, player)
          end
      end
    elseif sub_type == Card.SubtypeDefensiveRide then
      player:drawCards(1, skel.name)
      room:addPlayerMark(player, MarkEnum.AddMaxCards)
    end
  end,
})

return skel